import { namespace } from "store";
import { ApiController } from '../index';
import OrderClassDetail from "./order/Detail";
import OrderClassOrders from "./order/Orders";
import OrderClassOrdersVersion from "./order/OrdersVersion";


namespace Orders{
    let prefix="_napp"
    class orders extends ApiController{
        constructor() {
            super("Orders", prefix);
        }
        async echo(data:any) {
            console.log("测试调用远程方法");
            return this._post("echo",data)
        }
        /**
         * 添加订单
         * @param data 订单数据
         */
        async adds(data:any){
            console.log('调用远程保存方法');
            return this._post("adds",data)
        }
        /**
         * 删除订单
         * @param OrderID 订单id
         */
        async del(OrderID:number){
            return this._post(`del`,{OrderID})
        }
        /**
         * 查询单个订单（回显）
         * @param orderID 订单id
         * @param v 订单版本
         */
        async get(orderID:number,v:number){
            return this._post('get',{orderID,v})
        }
        /**
         * 修改订单
         * @param DBOrder 订单
         * @param DBOrderDetail 订单明细
         * @param DBOrderVersion 订单版本
         */
        async save(DBOrder:OrderClassOrders,DBOrderDetail:OrderClassDetail,DBOrderVersion:OrderClassOrdersVersion){
            return this._post(`save`,{DBOrder,DBOrderDetail,DBOrderVersion})
        }
        /**
         * 分页查询（精准搜索）
         * @param keyword 搜索关键字
         * @param P 页码数
         * @param N 显示条数
         */
        async search(Keyword:string,P:number,N:number){          
            return this._post('search',{Keyword,P,N});
        }
    }
    export const Orders=new orders();
}
export default Orders;